package com.yanqu.road.logic.activity.hotpotjump.game.choose;

import com.yanqu.road.logic.activity.hotpotjump.game.JumpBoardGrid;
import com.yanqu.road.logic.activity.hotpotjump.game.eJumpDirection;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * 1.交叉点
 */
public class HotpotJumpSkillChoose1 extends HotpotJumpSkillChoose {
    @Override
    public List<List<JumpBoardGrid>> chooseGrid() {
        List<List<JumpBoardGrid>> result = new ArrayList<>();
        List<JumpBoardGrid> crossGrids = new ArrayList<>();//有交叉的点
        for (JumpBoardGrid grid : gameLogic.getAllMoveGrids()) {
            Set<eJumpDirection> directions = gameLogic.getGridDirectionMap().getOrDefault(grid, new HashSet<>());
            if (directions.size() < 3) {
                continue;
            }
            if (crossGrids.contains(grid)) {
                continue;
            }
            crossGrids.add(grid);

        }

        for (JumpBoardGrid crossGrid : crossGrids) {
            List<JumpBoardGrid> grids = gameLogic.calcRangeGrids(crossGrid, skillRange, eJumpDirection.None);
            result.add(grids);
        }
        return result;
    }
}
